package com.esun.util.webviewchromeclient;

import com.esun.ui.R;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;



/** 
* @ClassName: CustomChooseDialog 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author: Kael gaojian@500wan.com
* @date: 2012-7-24 上午11:10:59 
*  
*/
public class CustomChooseDialog extends Dialog {
	private Button mLeftButton;
	private Button mRightButton;
	private TextView mTitleTextView;
	private TextView mMessageTextView;
	private CharSequence title;
	private CharSequence leftText;
	private CharSequence rightText;
	private CharSequence message;
	private View.OnClickListener leftOnClickListener;
	private View.OnClickListener rightOnClickListener;
	public CustomChooseDialog (Context context) {
		super(context, R.style.dialog);
		setContentView(R.layout.dialog_quit);
		init();
	}
	private void init () {
		mTitleTextView = (TextView) findViewById(R.id.dialogquit_tv_title);
		mMessageTextView = (TextView) findViewById(R.id.dialogquit_tv_msg);
		mLeftButton = (Button) findViewById(R.id.dialogquit_btn_submit);
		mRightButton = (Button) findViewById(R.id.dialogquit_btn_cancel);
	}
	@Override
	protected void onStart() {
		super.onStart();
		if (title != null) {
			mTitleTextView.setText(title);
		}
		if (message != null) {
			mMessageTextView.setText(message);
		}
		if (leftText != null) {
			mLeftButton.setText(leftText);
		}
		if (rightText != null) {
			mRightButton.setText(rightText);
		}
		if (leftOnClickListener != null) {
			mLeftButton.setOnClickListener(leftOnClickListener);
		}
		if (rightOnClickListener != null) {
			mRightButton.setOnClickListener(rightOnClickListener);
		}
	}
	public void setMessage (CharSequence message) {
		this.message = message;
	}
	
	public void setTitle (CharSequence title) {
		this.title = title;
	}
	
	public void setLeftButtonText (CharSequence text) {
		this.leftText = text;
	}
	
	public void setRightButtonText (CharSequence text) {
		this.rightText = text;
	}
	
	public void setOnLeftButtonClickListener (View.OnClickListener l) {
		this.leftOnClickListener = l;
	}
	public void setOnRightButtonClickListener (View.OnClickListener l) {
		this.rightOnClickListener = l;
	}
	
}
